<template>
  <div class="guide" @click="clickGuide">
    <el-tooltip :content="$t('msg.navBar.guide')">
      <svg-icon icon="guide" class-name="svgicon"></svg-icon>
    </el-tooltip>
  </div>
</template>

<script setup>
import Driver from 'driver.js'
import 'driver.js/dist/driver.min.css'
import { onMounted } from 'vue'
import { useI18n } from 'vue-i18n'
import steps from './defineStepsData'

const i18n = useI18n()
let driver
onMounted(() => {
  driver = new Driver({
    allowClose: false,
    closeBtnText: i18n.t('msg.guide.close'),
    nextBtnText: i18n.t('msg.guide.next'),
    prevBtnText: i18n.t('msg.guide.prev'),
    showButtons: true
  })
})

const clickGuide = () => {
  driver.defineSteps(steps(i18n))
  driver.start()
}
</script>

<style lang="scss" scoped>
.guide {
  margin-right: 10px;
  .svgicon {
    font-size: 20px;
  }
}
</style>
